//priority 48
/**
 * 稀有度类实现了怪物的稀有度的函数
*/
function RarityEntry(name) {
    BaseEntry.call(this, name)
    this.DefaultConfig = {//默认配置文件
        "Mistake": {
            Color: 0x777777
        },
        "Normal": {
            Color: 0x777777
        },
        "Familiar": {
            Color: 0x777777
        },
        "Scarce": {
            Color: 0x777777
        },
        "Rare": {
            Color: 0x777777
        },
        "Scarcity": {
            Color: 0x777777
        },
        "TopGrade": {
            Color: 0x777777
        },
        'Excellent': {
            Color: 0x777777
        },
        'Transcendence': {
            Color: 0x777777
        },
        'Superb': {
            Color: 0x777777
        }
    }
}
// 建立原型链
RarityEntry.prototype = Object.create(BaseEntry.prototype);
RarityEntry.prototype.constructor = RarityEntry;

//获得稀有度对应的名称
RarityEntry.prototype.getRarity = function (num) {
    switch (num) {
        case 0:
            return "Normal"
        case 1:
            return "Familiar"
        case 2:
            return "Scarce"
        case 3:
            return "Rare"
        case 4:
            return "Scarcity"
        case 5:
            return "TopGrade"
        case 6:
            return "Excellent"
        case 7:
            return "Transcendence"
        case 8:
            return "Superb"
    }
    return "Mistake"
};

//获取类的本地化键值，arguments代表不定长参数
RarityEntry.prototype.getText = function () {
    return Text.translate("rpg.monster.entry." + this.getName() + "." + arguments[0])
        .color(Color.of(this.Config[this.getRarity(arguments[0])].Color))
};

//怪物加载时候对怪物名称的修改
RarityEntry.prototype.ChangeName = function (nbt, name, monster, level) {
    name.splice(2, 0, this.getText(level), " ");//将词条等级放在名字前面等级后面
}

var a = new RarityEntry("rarity").init()
//注册技能自身
global.EntryHelper.RegisterEntry(a).AddToEntryGroup(a, "rarity_group")